The Universal Serial Bus (USB) is an electronic standard interface for connecting peripheral electronic devices to a host computer. USB connection ports exist on virtually all new personal computers and most electronic devices that are intended to attach to personal computers, such as printers, cameras, mice, keyboards, and many others. The USB is a standard interface defined and regulated by the USB Implementers Forum, Inc. (Universal Serial Bus Specification, revision 2.0, Apr. 27, 2000). Communication on the USB involves detailed protocols, rendering communication using USB devices complex for circuit designers.
A conventional technique for locating a given USB device includes several steps. In a first step, the technique determines how many devices are attached. In a second step, for each device, certain operations are performed. These operations include establishing a handle to the device, querying the device for its attributes, and comparing a specified attribute value with the corresponding attribute of the device sought.
An example of conventional solution is shown in FIG. 1. In the conventional solution, the code of FIG. 1 would find a device with a FriendlyName attribute equal to “Cy Streamer”, shown at 102. In another instance, the code would find a device having a VID (Vendor Identification) attribute equal to 0×04b4 and PID (Product Identification) attribute equal to 0×4C53, shown at 104.
The implementation of the conventional algorithm is lengthy, and is semantically unnatural. The looping portion of this algorithm needs to be re-coded for each different attribute by which the programmer wants to search for a device, which is inefficient and prone to errors.